package com.aphrodite.util.geom;

public class Dimension {

	public int height;

	public int width;

	public Dimension() {
		this(0, 0);
	}

	public Dimension(Dimension dimension) {
		this(dimension.width, dimension.height);
	}

	public Dimension(int width, int height) {
		this.width = width;
		this.height = height;
	}

	public boolean equals(Object obj) {
		if (obj instanceof Dimension) {
			Dimension dimension = (Dimension) obj;
			return width == dimension.width && height == dimension.height;
		} else {
			return false;
		}
	}

	public double getHeight() {
		return height;
	}

	public Dimension getSize() {
		return new Dimension(width, height);
	}

	public double getWidth() {
		return width;
	}

	public int hashCode() {
		int i = width + height;
		return (i * (i + 1)) / 2 + width;
	}

	public void setSize(Dimension dimension) {
		setSize(dimension.width, dimension.height);
	}

	public void setSize(double d, double d1) {
		width = (int) Math.ceil(d);
		height = (int) Math.ceil(d1);
	}

	public void setSize(int i, int j) {
		width = i;
		height = j;
	}

	public String toString() {
		return (new StringBuffer()).append(getClass().getName()).append("[width=").append(width).append(",height=")
				.append(height).append("]").toString();
	}

}